package HomeWOrk2;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.TreeSet;

public class test1 {
    public static void main(String[] args) {
        ArrayList<Integer> integers = new ArrayList<>();
        integers.add(1);
        integers.add(4);
        integers.add(6);
        integers.add(9);
        integers.add(4);
        integers.add(2);
        Collections.shuffle(integers);
        for (Integer integer : integers) {
            System.out.println(integer);
        }
        System.out.println("-----------------------");
        Collections.sort(integers);
        for (Integer integer : integers) {
            System.out.println(integer);
        }
        System.out.println("-----------------------");
        Comparator<Integer> integerComparator = new Comparator<>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                int result = o2 - o1;
                return result;
            }

        };
        Collections.sort(integers,integerComparator);
        for (Integer integer : integers) {
            System.out.println(integer);
        }
    }
}
